package gases.as3.librarys.compnents.resource.managers
{
	import flash.display.DisplayObject;
	
	import gases.as3.librarys.compnents.resource.elements.UISkinResElement_SingleSWF;
	import gases.as3.librarys.core.Interface.IDispose;
	import gases.as3.librarys.compnents.resource.net.ResResponse;

	/**
	 * 组件皮肤资源管理器 
	 * @author guwanyuan
	 * 
	 */	
	public class UIResourceManager implements IDispose
	{
		public function UIResourceManager()
		{
			init();
		}
		
		private function init():void
		{
			_uiSkinElement = new UISkinResElement_SingleSWF();
		}
		
		/**
		 * 设置单个UI皮肤资源 
		 * @param name
		 * @param data
		 * 
		 */		
		public function setUISkinResourceData(name:String, data:Object):void
		{
			_uiSkinElement.setSkinResource(name, data);
		}
		
		/**
		 * 设置UI皮肤资源 
		 * @param swf 资源SWF
		 * @param swfName 资源SWF标识名
		 * 
		 */		
		public function setUISkinSwf(swf:DisplayObject, swfName:String = null):void
		{
			_uiSkinElement.skinSwf = swf;
		}
		
		/**
		 * 获取UI皮肤资源 
		 * @param name 资源名
		 * @param response 回调请求
		 * @param swfName 从目标SWF获取的SWF名
		 * 
		 */		
		public function getUISkinRes(name:String, response:ResResponse , swfName:String = null):void
		{
			_uiSkinElement.getRes(name, response);
		}
		
		public function dispose():void
		{
			_uiSkinElement.dispose();
			_uiSkinElement = null;
		}
		
		private var _uiSkinElement:UISkinResElement_SingleSWF;
	}
}

